﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FoodandDining.Data;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace FoodandDining.VariableTemplate
{
    public class VariableTiles : DataTemplateSelector
    {
       
        public DataTemplate BigTemplate { get; set; }
        public DataTemplate CuisinesTemplate { get; set; }
        public DataTemplate TopRecipesTemplate { get; set; }
        public DataTemplate IngredientsLTemplate { get; set; }
        public DataTemplate IngredientsPTemplate { get; set; }
        public DataTemplate IngredientsSmallTemplate { get; set; }
        public DataTemplate AddOnsTemplate { get; set; }
        
    
      

        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            FrameworkElement element = container as FrameworkElement;

            if (element!=null && item != null)
            {
                
                if ((item as SampleDataItem).UniqueId.StartsWith("Big"))
                    return BigTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("Cuisines"))
                    return CuisinesTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("TopRecipes"))
                    return TopRecipesTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("IngredientsL"))
                    return IngredientsLTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("IngredientsP"))
                    return IngredientsPTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("IngredientsSmall"))
                    return IngredientsSmallTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("AddOns"))
                    return AddOnsTemplate;
               
                
            }
            return base.SelectTemplateCore(item, container);
        }

    }
}
